import md5 from 'js-md5';

let app={
    config:{
        apiUrl:"http://www.apiying.com/yuqing/"
    },
    storage:{
        set(key,value){
            localStorage.setItem(key,JSON.stringify(value))
        },
        get(key){
            var result = localStorage.getItem(key);
            if(result) return JSON.parse(result)
            else return '';
        },
        remove(key){
            localStorage.removeItem(key)
        },
    },
    sign(json) {
        var arr = [];
        for (var i in json) {
            arr.push(i);
        }
        arr = arr.sort();
        var str = '';
        for (let i = 0; i < arr.length; i++) {
            str += arr[i] + json[arr[i]]
        }
        //aaddKeywordssalt214214124125125uid2
        console.log('md5(str)',md5(str))
        return md5(str);
    }
}

export default app;